/**
 * 
 */
package com.ims.stocks.dao.employee;

import java.util.List;

import com.ims.common.dao.BaseDAOHibImpl;
import com.ims.stocks.model.Employee;

/**
 * @author Achal B.I
 *
 */
public class EmployeeDAOImpl extends BaseDAOHibImpl implements EmployeeDAO {

	@SuppressWarnings("unchecked")
	@Override
	public void txSaveOrUpdate(Employee employee) {

		org.hibernate.Query q = getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery("from Employee where employeeId = :employeeId ");
		q.setParameter("employeeId", employee.getEmployee().getEmployeeId());
		List<Employee> managerList = q.list();
		Employee manager = null;
		if(managerList.size()>0){
			manager = (Employee)q.list().get(0);
		}
		employee.setEmployee(manager);
		saveOrUpdateObject(employee);
		}

}
